﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace P2.Cuberry.Modules.Clinicom.BedList
{
    /// <summary>
    /// Interaction logic for Bed.xaml
    /// </summary>
    public partial class Bed : UserControl
    {
        public Bed()
        {
            InitializeComponent();
        }


        string _bedNo;
        public string BedNo
        {
            get { return _bedNo; }
            set { _bedNo = value; }
        }

        string _accountNo;
        public string AccountNo
        {
            get { return _accountNo; }
            set { _accountNo = value; }
        }

        string _patientName;
        public string PatientName
        {
            get { return _patientName; }
            set { _patientName = value; }
        }

        string _status;
        public string Status
        {
            get { return _status; }
            set { _status = value; }
        }

        string _gender;
        public string Gender
        {
            get { return _gender; }
            set { _gender = value; }
        }

        string _imageFileName;
        public string ImageFileName
        {
            get { return _imageFileName; }
            set { _imageFileName = value; }
        }


        public void repaint()
        {
            if (this.Status == "Occupied")
                this.ImageFileName = "P2.Desk.Resources." + this.Gender.ToLower() + "bett.bmp";
            else
                this.ImageFileName = "P2.Desk.Resources." + this.Status.ToLower() + "bett.bmp";

            //!!!to be completed!
            //this.bedImage.Source = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(this.ImageFileName));

            //this.pictureBox1.Image = Image.FromFile(this.ImageFileName);
            //Invalidate();
        }


        //private void TextWrap_Paint(object sender, PaintEventArgs e)
        //{
        //    string accountNoStr = this.AccountNo;
        //    string patNameStr = this.PatientName;
        //    string bedNoStr = this.BedNo;

        //    //StringFormat stringFormat = new StringFormat();
        //    //// Center each line of text.
        //    //stringFormat.Alignment = StringAlignment.Center; //(StringAlignment)Enum.Parse(typeof(StringAlignment), "Center");
        //    //// Center the block of text (top to bottom) in the rectangle.
        //    //stringFormat.LineAlignment = StringAlignment.Near;

        //    //stringFormat.FormatFlags = StringFormatFlags.DirectionRightToLeft;

        //    //// Set the wrap style.
        //    //stringFormat.Trimming = (StringTrimming)Enum.Parse(typeof(StringTrimming), "None");

        //    //Font font = new Font("Arial", 8, FontStyle.Bold);
        //    //Rectangle rect = new Rectangle(37, 20, 60, 20);
        //    //e.Graphics.DrawString(accountNoStr, font, Brushes.White, rect, stringFormat);

        //    //Font font2 = new Font("Arial", 11, FontStyle.Bold);
        //    //Rectangle rect2 = new Rectangle(24, 40, 86, 60);
        //    //e.Graphics.DrawString(patNameStr, font2, Brushes.White, rect2, stringFormat);


        //    //Font font3 = new Font("Arial", 9, FontStyle.Bold);
        //    //Rectangle rect3 = new Rectangle(22, 98, 81, 16);
        //    //SolidBrush myBrush = new SolidBrush(Color.FromArgb(64, 64, 64));
        //    //e.Graphics.DrawString(bedNoStr, font3, myBrush, rect3, stringFormat);

        //    ////Pen pen = Pens.Transparent; // Black;
        //    ////e.Graphics.DrawRectangle(pen, rect);
        //}



        private void bedImage_ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {
            MessageBox.Show(this.PatientName + " Bed No:" + this.BedNo + " Account No: " + this.AccountNo + " Status: " + this.Status);
        }


    }
}
